using System;
using BruteForce.UserInterface.Abstracts;
using BruteForce.Utilities;
using Microsoft.Xna.Framework;

namespace BruteForce.UserInterface.UIControls
{
    public class InteractiveLabel : AbstractUIControl
    {
        private String _labelText;
        private Color _labelTextColor;
        delegate string DelegateFunction();
        private DelegateFunction _function;

        public InteractiveLabel(string name, string labelText, Rectangle surroundingRectangle, Func<string> method)
            : base(name, surroundingRectangle)
        {
            _labelTextColor = Color.Blue;
            _labelText = labelText;
            _function = new DelegateFunction(method);
        }

        public override void Update()
        {
        }

        public void SetLabelText(string labeltext)
        {
            _labelText = labeltext;
        }

        public void SetLabelTextColor(Color color)
        {
            _labelTextColor = color;
        }

        public override void Draw(GameTime gameTime)
        {
            Draws.DrawString(CurrentUIcontrolRectangle.X, CurrentUIcontrolRectangle.Y, _labelText +_function(), _labelTextColor);
        }
    }
}